// --------------------------------------------------------------------------------------------------------------------
// <copyright file="PrefixLocalCallsWithThis.cs" company="StyleCop for ReSharper Development Team">
//   Copyright (c) StyleCop for ReSharper Development Team. All rights reserved.
// </copyright>
// <summary>
//   Defines the PrefixLocalCallsWithThis type.
// </summary>
// --------------------------------------------------------------------------------------------------------------------

namespace StyleCop.For.ReSharper.BulbItems.Readability
{
    #region Using Directives

    using JetBrains.ProjectModel;
    using JetBrains.ReSharper.Psi;
    using JetBrains.ReSharper.Psi.CSharp.CodeStyle;
    using JetBrains.ReSharper.Psi.CSharp.Impl.CodeStyle;
    using JetBrains.TextControl;

    using StyleCop.For.ReSharper.BulbItems.Framework;
    using StyleCop.For.ReSharper.Core;

    #endregion

    /// <summary>
    /// QuickFix action which prefixing the local call with "this.".
    /// </summary>
    public class PrefixLocalCallsWithThis : V5BulbItemImpl
    {
       public override void ExecuteTransactionInner(ISolution solution, ITextControl textControl)
        {
            var file = Utils.GetCSharpFile(solution, textControl);

            var marker = PsiManager.GetInstance(solution).CreatePsiRangeMarker(this.DocumentRange);

            file.ArrangeThisQualifier(marker);
        }
    }
}